﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

using AimGameLibrary;
using AimGameEngine.EditorObject;

namespace AimGameEngine.NodeEditorObject
{
    public class NodeColor : NodeBaseControl
    {
        public Color mycolor;

        public NodeColor(SpriteBatch inputspritebatch, Camera inputcamera, NodeData inputData
            , List<IDraw> MyListDraw, List<IUpdateMainTime> MyListUpdateTime, Dictionary<String, NodeObject> MyListObject, Dictionary<String, NodeObject> MyListType)
            : base(inputspritebatch, inputcamera, inputData, MyListDraw,MyListUpdateTime, MyListObject, MyListType)
	    {
            mycolor = Color.White;
            InputMode = NodeInputMode.None;

            Connecter outputColor = new Connecter(inputspritebatch, inputcamera, Syco.Output, NodeTypeValue.Color, this);
            ListConnectpoint.Add(outputColor);
	    }

        public override void ShowProprety(ArrayList Temp, CallBack input)
        {
            base.ShowProprety(Temp, input);
            PropretyColor color = new PropretyColor(this);
            //color.Deactivate += new EventHandler(input.Deactivate);
            color.okButton.Click += new EventHandler(input.Deactivate);
            color.ShowDialog();
            
        }

        protected override Dictionary<string, NodeObject> GetDictionaryNode(Dictionary<string, NodeObject> TempNode)
        {
            if (this.MyData.Data != null)
                if (this.MyDictionaryObject.ContainsKey(this.MyData.Data))
                    TempNode.Add(this.MyData.Data, this.MyDictionaryObject[this.MyData.Data]);

            return base.GetDictionaryNode(TempNode);
        }

        public override void SaveData(System.Collections.ArrayList Thislist, SaveMode inputsavemode)
        {
            base.SaveData(Thislist, inputsavemode);

            //Thislist.Add(InputMode);
            Thislist.Add(mycolor);
        }

        public override void LoadData(Identification getdata, int IndexData)
        {
            base.LoadData(getdata, IndexData);

            //if (getdata.Items.GetValue(IndexData + 1).GetType() == typeof(NodeInputMode))
            //    InputMode = (NodeInputMode)getdata.Items.GetValue(IndexData + 1);

            if (getdata.Items.GetValue(IndexData + 1).GetType() == typeof(Color))
                mycolor = (Color)getdata.Items.GetValue(IndexData + 1);

            SetupProprety();
        }
    }
}
